import request from '@/api/request'

// 获取商品列表
export function requestProductList(info, data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/product/productsByPage/${info.start}/${info.limit}`,
    data
  })
}

// 删除商品信息
export function deleteProduct(id) {
  return request({
    method: 'delete',
    url: `/lejuAdmin/product/del/${id}`
  })
}

// 添加商品
export function addProduct(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/product/addProductAndSkus`,
    data
  })
}

// 更新商品
export function updataProduct(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/product/updateProductAndSkus`,
    data
  })
}

// 获取品牌列表
export function requestBrandList() {
  return request({
    method: 'get',
    url: `/lejuAdmin/brand/findAllBrand`
  })
}

// 获取品牌列表分页
export function requestBrandListByPage(page) {
  return request({
    method: 'get',
    url: `/lejuAdmin/brand/findBrandByPage/${page.start}/${page.limit}`
  })
}

// 品牌是否展示
export function switchShowStatus(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/brand/switchShowStatus`,
    data
  })
}

// 添加品牌
export function addBrand(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/brand/addBrand`,
    data
  })
}

// 更新品牌
export function updateBrand(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/brand/updateBrand`,
    data
  })
}

// 删除品牌
export function deleteBrand(id) {
  return request({
    method: 'delete',
    url: `/lejuAdmin/brand/delBrand/${id}`
  })
}

// 获取分类列表
export function requestCategoryList() {
  return request({
    method: 'get',
    url: `/lejuAdmin/category/getAllCategory`
  })
}

// 删除分类信息
export function deleteCategory(id) {
  return request({
    method: 'delete',
    url: `/lejuAdmin/category/delCategory/${id}`
  })
}

// 添加分类
export function addCategory(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/category/addCategory`,
    data
  })
}

// 更新分类
export function updateCategory(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/category/updateCategory`,
    data
  })
}

// 获取商品详情
export function requestProductInfo(id) {
  return request({
    method: 'get',
    url: `/lejuAdmin/product/productSkusDetail/${id}`
  })
}

// 根据商品id查询库存
export function requestSkuInfo(id) {
  return request({
    method: 'get',
    url: `/lejuAdmin/sku/getSkusByProductId/${id}`
  })
}

// 更新库存信息
export function addSkuInfo(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/sku/addProductSkus`,
    data
  })
}

// 删除库存信息
export function deleteSku(id) {
  return request({
    method: 'delete',
    url: `/lejuAdmin/sku/delSku/${id}`
  })
}

// 更新库存信息
export function updateSkuInfo(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/sku/updateSkuInfo`,
    data
  })
}

// 更改是否最新
export function switchNewStatus(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/product/switchNewStatus`,
    data
  })
}

// 更改是否预告
export function switchPreviewStatus(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/product/switchPreviewStatus`,
    data
  })
}

// 更改发布状态
export function switchPublishStatus(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/product/switchPublishStatus`,
    data
  })
}

// 更改是否推荐
export function switchRecommandStatus(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/product/switchRecommandStatus`,
    data
  })
}

// 更改审核状态
export function switchVerifyStatus(data) {
  return request({
    method: 'post',
    url: `/lejuAdmin/product/switchVerifyStatus`,
    data
  })
}

